/**
 * @param {number[]} height
 * @return {number}
 */
var maxArea = function (height) {
    // 双指针
    let left = 0, right = height.length - 1, result = 0
    while (left < right) {
        let curArea = Math.min(height[left], height[right]) * (right - left)
        result = Math.max(result, curArea)
        // 哪边的值较小，移动哪边的指针
        if (height[left] <= height[right]) {
            left++
        } else {
            right--
        }
    }
    return result
};